$("#form-productSpecification-edit").validate({
	rules:{
		specName:{
			required:true,
		},
	},
	submitHandler:function(form){
		edit();
	}
});


function edit() {
	var specId = $("input[name='specId']").val();
	var specName = $("input[name='specName']").val();
	var typeId = $("select[name='typeId']").val();
	var typeName = $("select[name='typeId'] option:selected").text();
	var specStatus = $("input[name='specStatus']").is(':checked') == true ? 1 : 0;
	$.ajax({
		cache : true,
		type : "POST",
		url : ctx + "module/productSpecification/save",
		data : {
			"specId": specId,
			"specName": specName,
			"typeId": typeId,
			"typeName": typeName,
			"specStatus": specStatus,
		},
		async : false,
		error : function(request) {
			$.modalAlert("系统错误", "error");
		},
		success : function(data) {
			if (data.code == 0) {
				parent.layer.msg("新增成功,正在刷新数据请稍后……",{icon:1,time: 500,shade: [0.1,'#fff']},function(){
					$.parentReload();
				});
			} else {
				$.modalAlert(data.msg, "error");
			}

		}
	});
}